package org.kimoji.comment.web;

import org.kimoji.comment.service.CommentService;
import org.kimoji.entity.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class CommentController {

	@Autowired
	private CommentService commentService;
	
	@RequestMapping(value="comment/{itemId}/{page}")
	@ResponseBody
	public Object showComment(@PathVariable String itemId,@PathVariable int page){
		return commentService.getCommentsByItemId(itemId, page);
	}
	
	@RequestMapping(value="comment/save")
	@ResponseBody
	public Object saveComment(Comment comment){
		return commentService.saveComment(comment);
	}
}
